﻿@{
    ViewBag.Title = "UnitBatchForm";
    Layout = "~/Views/Shared/_LayoutIndex.cshtml";
}
<script>
    var keyValue = request('keyValue'), organizeid = "";
    $(function () {
        InitialPage();
        GetTree();
    });
    //初始化页面
    function InitialPage() {
        //layout布局
        $('#layout').layout({
            applyDemoStyles: true,
            onresize: function () {
                $(window).resize()
            }
        });
        //resize重设(表格、树形)宽高
        $(window).resize(function (e) {
            window.setTimeout(function () {
                $("#itemTree").setTreeHeight($(window).height() - 51.5);
            }, 200);
            e.stopPropagation();

        });

        //性质
        $("#Nature").ComboBox({
            data: [{ "key": "1", "value": "单元表" }, { "key": "3", "value": "虚拟表" }],
            id: "key",
            text: "value",
            description: "==请选择==",
        });
        $("#Type").ComboBoxTree({
            url: "../../SystemManage/DataItemDetail/GetDataItemTreeJson?Encode=EnergyMeterType",
            description: "==请选表类型==",
            height: "250px"
        });
        //组织机构
        $("#OrganizeId").ComboBoxTree({
            url: "../../BaseManage/Organize/GetTreeJsonById",
            description: "==请选择组织机构==",
            height: "250px",
            click: function (item) {
                organizeid = item.id;
                GetTree();
            }
        });
        if (organizeid != "") $("#OrganizeId").ComboBoxTreeSetValue(organizeid);

        $("#PStructId").ComboBoxTree({
            url: "../../ResourceManage/RS_PStructs/GetTreeJson?type=5&organizeid=" + organizeid,
            description: "==请选择组织机构==",
            height: "250px"
        });

        $("#PRoomType").ComboBox({
            data: [{ "key": "1", "value": "全部" }, { "key": "2", "value": "已入住" }, { "key": "3", "value": "空置" }],
            id: "key",
            text: "value",
            description: "==请选择=="
        });
        $("#PRoomType").ComboBoxSetValue("1");

        $("#Property").ComboBoxTree({
            url: "../../ResourceManage/RS_PStructs/GetTreeJson?type=1&organizeid=" + organizeid,
            description: "==请选择楼盘==",
            height: "250px"
        });
        $("#PFloor").ComboBoxTree({
            url: "../../ResourceManage/RS_PStructs/GetTreeJson?type=3&organizeid=" + organizeid,
            description: "==请选择楼栋==",
            height: "250px"
        });
    }
    function GetTree() {
        var item = {
            height: $(window).height() - 55.5,
            url: "../../ResourceManage/RS_EnergyMeter/GetUnitTree",
            onnodeclick: function (item) {
                
                if (item.Type == "1") {
                    $('#Name').val(item.text);
                    $('#Name').text(item.id);
                    $("#Nature").ComboBoxSetValue(item.value);
                    $("#Type").ComboBoxSetValue(item.title);
                    $('#Name').attr('disabled', 'disabled');
                    $('#Nature').attr('disabled', 'disabled');
                    $('#Type').attr('disabled', 'disabled');

                }
                else {
                    $('#Name').val();
                    $('#Name').text();
                    $("#Nature").ComboBoxSetValue("");
                    $("#Type").ComboBoxSetValue("");
                    $('#Name').removeAttr('disabled');
                    $('#Nature').removeAttr('disabled');
                    $('#Type').removeAttr('disabled');
                }

            }
        };
        //初始化
        $("#itemTree").treeview(item);
    }
</script>
<style>
    #MeterHead td{left:-31px;}
    #box_border {
        border: 1px solid #EDEDED;
        height: 50px;
        line-height: 50px;
        text-align: center;
    }
    #fang_type {
        list-style-type: none;
    }

        #fang_type li {
            width: 80px;
            height: 22px;
            line-height: 22px;
            color: #FFF;
            display: inline-block;
        }
</style>
<div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
    <div class="ui-layout-west">
        <div class="west-Panel" style="margin: 0px; border-top: none; border-left: none; border-bottom: none;">
            <div class=" panel-title" style="padding:0px;"><div id="OrganizeId" type="selectTree" class="ui-select"></div></div>
            <div id="itemTree" style=" height: 98%;"></div>
        </div>
    </div>
    <div class="ui-layout-center">
        <table class="form" id="MeterHead">
                <tr>
                    <td class="formTitle">表名称<font face="宋体">*</font></td>
                    <td class="formValue">
                        <input id="Name" readonly type="text" class="form-control input-underline" isvalid="yes" checkexpession="NotNull" />
                    </td>
                    <td class="formTitle">表性质<font face="宋体">*</font></td>
                    <td class="formValue">
                        <div id="Nature" readonly type="selectTree" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
                    </td>
                    <td class="formTitle">表类型<font face="宋体">*</font></td>
                    <td class="formValue">
                        <div id="Type" readonly type="selectTree" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
                    </td>
                </tr>
                <tr>
                    <td class="formTitle">所属区域<font face="宋体">*</font></td>
                    <td class="formValue" colspan="5">
                        <div id="PStructId" readonly type="selectTree" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
                    </td>
                </tr>
                <tr>
                    <td class="formTitle">备注</td>
                    <td class="formValue" colspan="5">
                        <textarea id="Description" readonly class="form-control" style="height: 70px;"></textarea>
                    </td>
                </tr>
            </table>
        <table style="margin:10px;">
            <tr>
                <td> 选择楼盘:</td>
                <td width="200">
                    <div id="Property" type="selectTree" class="ui-select"></div>
                </td>
                @*<td> 房间类型:</td>*@
                <td width="200"  style="padding-left: 5px;">
                    <div id="PRoomType" type="selectTree" class="ui-select"></div>
                </td>
            </tr>
        </table>
      
          <div class="center-Panel" style="margin: 0px; border-right: none; border-left: none; border-bottom: none; background-color: #fff; overflow: auto; padding-bottom: 10px;">
              <div id="box_border">
                  <ul id="fang_type">
                      <li style="width: 160px;"></li>
                      <li style="background-color: #917430;">待安装</li>
                      <li style="background-color: #b51d1a;">已安装</li>
                      <li style="background-color: #000EFF;">其他</li>
                  </ul>
              </div>
              <table class="unit-the-table table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                  <tbody>
                      <tr>
                          <td style="color:#1853A1;">1层</td>
                          <td  style="background-color: #917430" >
                              <a class="fy_table_td" style="color:#fff;">1-111</a>
                          </td>
                          <td  style="background-color: #000EFF" >
                              <a  class="fy_table_td" style="color:#fff;">1-112</a>
                          </td>
                          <td  style="background-color: #000EFF">
                              <a  class="fy_table_td" style="color:#fff;">1-113</a>
                          </td>
                          <td  style="background-color: #917430" >
                              <a  class="fy_table_td" style="color:#fff;">1-211</a>
                          </td>
                          <td  style="background-color: #917430" >
                              <a  class="fy_table_td" style="color:#fff;">1-212</a>
                          </td>
                          <td  style="background-color: #917430" >
                              <a class="fy_table_td" style="color:#fff;">1-213</a>
                          </td>
                          <td  style="background-color: #917430" >
                              <a  class="fy_table_td" style="color:#fff;">1-311</a>
                          </td>
                          <td style="background-color: #000EFF" >
                              <a  class="fy_table_td" style="color:#fff;">1-312</a>
                          </td>
                          <td style="background-color: #917430" >
                              <a  class="fy_table_td" style="color:#fff;">1-313</a>
                          </td>
                      </tr>
                      <tr>
                          <td style="color:#1853A1;">1层</td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-111</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-112</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-113</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-211</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-212</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-213</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-311</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-312</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-313</a>
                          </td>
                      </tr>
                      <tr>
                          <td style="color:#1853A1;">1层</td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-111</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-112</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-113</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-211</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-212</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-213</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-311</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-312</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-313</a>
                          </td>
                      </tr>
                      <tr>
                          <td style="color:#1853A1;">1层</td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-111</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-112</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-113</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-211</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-212</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-213</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-311</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-312</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-313</a>
                          </td>
                      </tr>
                      <tr>
                          <td style="color:#1853A1;">1层</td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-111</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-112</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-113</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-211</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-212</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-213</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-311</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-312</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-313</a>
                          </td>
                      </tr>
                      <tr>
                          <td style="color:#1853A1;">1层</td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-111</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-112</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-113</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-211</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-212</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-213</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-311</a>
                          </td>
                          <td style="background-color: #000EFF">
                              <a class="fy_table_td" style="color:#fff;">1-312</a>
                          </td>
                          <td style="background-color: #917430">
                              <a class="fy_table_td" style="color:#fff;">1-313</a>
                          </td>
                      </tr>
                  </tbody>
              </table>
            </div>
        </div>
    </div>
</div>
